const returnSchoolModel = require('./model/returnSchoolModel');

// 添加返校信息
module.exports.addReturnInfoDao = async function (returnInfo) {
    const result = await returnSchoolModel.create(returnInfo);
    return result.dataValues;
}
// 分页获取返校信息
module.exports.getReturnListDao = async function (page, limit) {
    return await returnSchoolModel.findAndCountAll({
        offset: (page * 1 - 1) * limit,
        limit: limit * 1,
        order: [
            ['startTime', 'desc']
        ]
    });
}
// 修改某个返校信息
module.exports.updateReturnDao = async function (id, returnInfo) {
    return await returnSchoolModel.update(returnInfo, {
        where: {
            id
        }
    })
}